package com.yuwen.example.consumer;

import com.yuwen.RpcApplication;
import com.yuwen.example.common.model.User;
import com.yuwen.example.common.service.UserService;
import com.yuwen.yuwenRPC.bootstrap.ConsumerBootstrap;
import com.yuwen.yuwenRPC.config.RpcConfig;
import com.yuwen.yuwenRPC.proxy.ServiceProxyFactory;

/**
 * @ClassNameConsumerExample
 * @Description TODO
 * @Author钰玟
 * @Date2025/3/30 下午1:45
 * @Version 1.0
 **/

public class ConsumerExample {
    public static void main(String[] args) {
        /**
         * 服务消费者初始化
         */
        ConsumerBootstrap.init();

        UserService userService = ServiceProxyFactory.getProxy(UserService.class);

        User user = new User();
        user.setName("yuwen");
        //调用 userService的实现类 获取对象user
        User newUser = userService.getUser(user);
        if(newUser != null) {
            System.err.println(newUser.getName());
        }else{
            System.out.println("newUser == null");
        }
        short num = userService.getNum();
        System.out.println("@@@"+num);
    }
}
